from time import sleep
from page_locators.school_album_locator import SchoolAlbumLocators as SAL
from common.base_page import BasePage 
from test_datas.pic_data import *


class SchoolAlbum(BasePage):

    def __init__(self, driver):
        super().__init__(driver)

    def class_photos_menu(self):
        self.click(SAL.school_album, "学校相册菜单定位失败截图")


    def create_pic_albums(self):
        self.click(SAL.create_pic_albums, "创建相册按钮定位失败截图")


    def albums_name_error1(self):
        self.input(SAL.albums_name, "春季运动会", "创建相册/名称输入框定位失败截图")
        self.click(SAL.submit_albums, "提交按钮定位失败截图")


    def albums_name_error2(self):
        self.click(SAL.create_pic_albums, "创建相册按钮定位失败截图")
        self.input(SAL.albums_name, "", "创建相册/名称输入框定位失败截图")
        self.click(SAL.submit_albums, "提交按钮定位失败截图")


    def albums_name_succwss1(self):
        self.click(SAL.create_pic_albums, "创建相册按钮定位失败截图")
        self.input(SAL.albums_name, " ", "创建相册/名称输入框定位失败截图")
        self.click(SAL.submit_albums, "提交按钮定位失败截图")


    def albums_name_succwss2(self):
        self.click(SAL.create_pic_albums, "创建相册按钮定位失败截图")
        self.input(SAL.albums_name, "春季运动会", "创建相册/名称输入框定位失败截图")
        self.click(SAL.submit_albums, "提交按钮定位失败截图")

    def albums_name_succwss3(self):
        self.click(SAL.create_pic_albums, "创建相册按钮定位失败截图")
        self.input(SAL.albums_name, "^&", "创建相册/名称输入框定位失败截图")
        self.click(SAL.submit_albums, "提交按钮定位失败截图")


    def choose_class_success(self):
        self.click(SAL.create_pic_albums, "创建相册按钮定位失败截图")
        self.input(SAL.albums_name, "冬季运动会", "创建相册/名称输入框定位失败截图")
        self.click(SAL.submit_albums, "提交按钮定位失败截图")

    def search_error1(self):
        self.input(SAL.search, "123", "搜索查找输入框定位失败截图")

    def search_error2(self):
        self.input(SAL.search, " ", "搜索查找输入框定位失败截图")

    def search_error3(self):
        self.input(SAL.search, "^", "搜索查找输入框定位失败截图")

    def search_success1(self):
        self.choose_class_success()
        self.input(SAL.search, "春季运动会", "搜索查找输入框定位失败截图")

    def search_success2(self):
        self.input(SAL.search, "运动会", "搜索查找输入框定位失败截图")

    def input_click(self):
        self.suspension_loc(SAL.first_albuns, SAL.input_click, "上传按钮定位失败截图")

    def input_pic_error1(self):
        self.input_click()
        self.upload_file(SAL.input_pic, webp_path, "上传标签定位失败截图")

    def input_pic_success1(self):
        self.input_click()
        self.upload_file(SAL.input_pic, cover_pic, "上传标签定位失败截图")
        sleep(1)
        self.suspension_loc(SAL.pic, SAL.delete, "删除图标定位失败截图")

    def input_pic_success2(self):
        self.input_click()
        self.upload_file(SAL.input_pic, cover_pic, "上传标签定位失败截图")
        sleep(1)
        self.click(SAL.unsure, "取消按钮定位失败截图")
        self.suspension_loc(SAL.first_albuns, SAL.view, "查看按钮定位失败截图")

    def input_pic_success3(self):
        self.input_click()
        self.upload_file(SAL.input_pic, cover_pic, "上传标签定位失败截图")
        sleep(1)
        self.click(SAL.sure, "确定按钮定位失败截图")
        self.suspension_loc(SAL.first_albuns, SAL.view, "查看按钮定位失败截图")


    def input_pic_success4(self):
        self.input_pic_success3()

    def input_pic_success5(self):
        self.input_click()
        self.upload_file(SAL.input_pic, video_path, "上传标签定位失败截图")
        sleep(1)
        self.click(SAL.sure, "确定按钮定位失败截图")
        self.suspension_loc(SAL.first_albuns, SAL.view, "查看按钮定位失败截图")

    def delete_list_fist(self):
        self.suspension_loc(SAL.first_albuns, SAL.dle, "相册删除按钮定位失败截图")
        self.click(SAL.sure_del, "确定删除按钮定位失败截图")


